'''
Author: your name
Date: 2021-11-06 17:04:30
LastEditTime: 2021-11-06 17:11:42
LastEditors: Please set LastEditors
Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
            以灰度加载图像，显示图像，按 s 保存图像并推出，或者按 ESC 键直接退出不保存
FilePath: /opencv-python/show_image/cv_imwrite.py
'''
import numpy as np
import cv2

img = cv2.imread('/Users/simon.yang/Programming/cv-learning/image/lens.jpeg')
cv2.imshow('image', img)
k = cv2.waitKey(0) & 0xFF # For 64 bit
# 等待 ESC 退出
if k == 27:
    cv2.destroyAllWindows()
# 等待关键字，保存和退出
elif k == ord('s'):
    cv2.imwrite('len_cv_imwrite', img)
    cv2.destroyAllWindows()

